package com.back.network.netty.dto;

public class CommonDTO {
	public static final String SUCCESS = "0000";
	public static final String FAIL = "9999";
	public static final String SUCCESS_MSG = "成功";
	public static final String FAIL_MSG = "失败";
	private String code;
	private String msg;
	private Object data;

	public CommonDTO() {

	}

	public CommonDTO(String code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public CommonDTO(String code, String msg, Object data) {
		this.code = code;
		this.msg = msg;
		this.data = data;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public static CommonDTO success() {
		return new CommonDTO(SUCCESS, SUCCESS_MSG);
	}

	public static CommonDTO success(String msg) {
		return new CommonDTO(SUCCESS, msg);
	}

	public static CommonDTO fail() {
		return new CommonDTO(FAIL, FAIL_MSG);
	}

	public static CommonDTO fail(String msg) {
		return new CommonDTO(FAIL, msg);
	}
}
